
package jz.dataCenter.extractData;

import jg.exJson.reg.PlasmadonorsJson;
import jz.utils.JzConstants;
import SoftFan.util.textUnit;
import SoftFan.workflow.protocol.db.wf_Db_Unit;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class ExtractRegData {

	public String exec(jz.dbUnit.gjzxx.GJZXX data) throws Exception {

		PlasmadonorsJson plasmadonors = new PlasmadonorsJson();
		try {
			plasmadonors.setId(data.getId());
			plasmadonors.setXm(data.getXm());
			plasmadonors.setCardId(data.getCardid());
			plasmadonors.setSfz(data.getSfz());

			plasmadonors.setJg(textUnit.ObjToString(data.getJgidDisplay()));

			plasmadonors.setDz(data.getDz());

			plasmadonors.setPhone(data.getPhone());
			plasmadonors.setMail(data.getMail());
			
			plasmadonors.setBirthday(data.getBirthday());

			plasmadonors.setXb(textUnit.ObjToString(data.getXmidDisplay()));
			plasmadonors.setXx(textUnit.ObjToString(data.getXxidDisplay()));

			plasmadonors.setJz(JzConstants.getInstance().getJzName());

			plasmadonors.setJydzid(data.getJydzid());

			plasmadonors.setHeadPhoto(wf_Db_Unit.getUploadBlobData(data.getPhoto()));

			plasmadonors.setIdcardPhoto(wf_Db_Unit.getUploadBlobData(data.getIdcardphoto()));
			plasmadonors.setIdcardPhoto1(wf_Db_Unit.getUploadBlobData(data.getIdcardphoto1()));

			plasmadonors.setFingerPrint(data.getFingerprint());

			return JSON.toJSONString(plasmadonors, SerializerFeature.WriteNullListAsEmpty);
		} finally {
			plasmadonors.free();
		}
	}

}
